fix: devspaces sudo support with correct UID and user setup#735
Conversation
Fixes sudo execution in the Dev Spaces workspace image by removing the injected base image user (uid 10001) and recreating it with uid 1000 to match the SCC-enforced UID. Adds ADT_CONTAINER_ENGINE=podman to devfile. Based on work by @cgruver in ansible#734. Co-Authored-By: cgruver <39659182+cgruver@users.noreply.github.com>
alisonlhart
left a comment
There was a problem hiding this comment.
Awesome stuff.
Can some tests/verification be added? If it's too difficult to add specific tests, we should have a few in-line checks. I suggested one.
Co-Authored-By: alisonlhart <alisonlhart@users.noreply.github.com>
|
Hi — the fix from this PR is confirmed working in The second entry is injected by OpenShift's CRI-O runtime when the SCC assigns a UID from the namespace range. Since the image already has This causes:
Tracking the runtime behavior issue separately at rhpds/ansible-dev-tools-workspace#10. This may need a different approach for the DevSpaces image (e.g., not pre-creating |
|
Follow-up on the sudo fix — we tested on DevSpaces 3.27.0 / OCP 4.21.9 and v26.4.4 (tenant user-bm7f6): v26.4.5 (tenant user-jtvxh): The workspace pods land on the The UID cleanup from this PR is likely still a prerequisite for sudo to work, but it may not be sufficient on its own — the SCC/security context also needs to allow privilege escalation. Still investigating whether this is a cluster configuration issue or something that needs to be addressed in the DevWorkspace/CheCluster setup. We need to figure out if there are specific SCC settings, CheCluster configuration, or DevWorkspace attributes required for sudo to work in DevSpaces — this will need to be addressed in the documentation for GA as part of the configuration requirements. Tracking at rhpds/ansible-dev-tools-workspace#10. |
v26.4.4 rollback confirmed the terminal crash is not image-specific. Restoring v26.4.5 which includes the UID/passwd fix from ansible/ansible-dev-tools#735. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
v26.4.4 rollback confirmed the terminal crash is not image-specific. Restoring v26.4.5 which includes the UID/passwd fix from ansible/ansible-dev-tools#735. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@leogallego I successfully started a workspace from this repo, main revision. Sudo works as expected. When you are online today, ping me and we'll take a look at your config. |
##### [\`26.4.5\`](https://github.com/ansible/ansible-dev-tools/releases/tag/v26.4.5) #### Fixes - fix: pass adt env to tox ([#733](ansible/ansible-dev-tools#733)) [@rockygeekz](https://github.com/rockygeekz) #### Maintenance - fix: devspaces sudo support with correct UID and user setup ([#735](ansible/ansible-dev-tools#735)) [@leogallego](https://github.com/leogallego) - chore(deps): update pep621 ([#732](ansible/ansible-dev-tools#732)) @[renovate\[bot\]](https://github.com/apps/renovate) - chore(deps): update all dependencies ([#731](ansible/ansible-dev-tools#731)) @[renovate\[bot\]](https://github.com/apps/renovate)
##### [\`26.4.5\`](https://github.com/ansible/ansible-dev-tools/releases/tag/v26.4.5) #### Fixes - fix: pass adt env to tox ([#733](ansible/ansible-dev-tools#733)) [@rockygeekz](https://github.com/rockygeekz) #### Maintenance - fix: devspaces sudo support with correct UID and user setup ([#735](ansible/ansible-dev-tools#735)) [@leogallego](https://github.com/leogallego) - chore(deps): update pep621 ([#732](ansible/ansible-dev-tools#732)) @[renovate\[bot\]](https://github.com/apps/renovate) - chore(deps): update all dependencies ([#731](ansible/ansible-dev-tools#731)) @[renovate\[bot\]](https://github.com/apps/renovate)
Summary
user(uid 10001) and recreate with uid 1000 to match the SCC-enforced UID, fixing duplicate/etc/passwdand/etc/groupentries that preventedsudofrom workingusermod -L) and set/etc/shadowpermissions to avoid PAM errors in the workspace containerADT_CONTAINER_ENGINE=podmanenv var todevfile.yamlfor tox podman supportuserdelwithidcheck so the build doesn't break if the base image drops theuseraccountBased on work by @cgruver in #734 (closed due to GPG signing issues). Incorporates all review feedback from that PR.
Test plan
tox -e devspaces)sudoworks without password promptspodmanworks inside the workspace/etc/passwdand/etc/group